import request from '@/router/axios'


export function getRuleTrans(obj) {  //查询互动积分规则分页列表
  return request({
    url: '/api/loyalty/pointsRuleTrans/ruleTrans/page',
    method: 'post',
    data:obj
  })
}


export function savebasicrule(obj) {  // 保存基础积分规则
    return request({
      url: '/api/loyalty/pointsRule',
      method: 'post',
      data:obj
    })
}

// 渠道类型
export function fetchChannelList(obj) {
  return request({
    url: '/api/basic/channel/list',
    method: 'get',
    data: obj
  })
}

//等级
export function fetchLeveltList(obj) {  // 查询订单列表
  return request({
    url: '/api/customer/levelRule/list',
    method: 'POST',
    data:obj
  })
}


export function editgrade(obj) {  // 编辑促销积分规则
  return request({
    url: '/api/campaign/campaignQuery',
    method: 'post',
    data:obj
  })
}

export function pointsRuleBasic(obj) {  // 查询促销积分获取规则
  return request({
    url: '/api/loyalty/pointsRule/basic',
    method: 'get',
    data:obj
  })
}

export function fetchsalesrule(obj) {  //
  return request({
    url: '/api/loyalty/pointsRuleTrans',
    method: 'post',
    data:obj
  })
}

export function editintegral(obj) {  // 编辑促销积分规则
  return request({
    url: '/api/loyalty/pointsRuleTrans/' + obj.id,
    method: 'put',
    data:obj
  })
}

export function fetchproductlist(obj) {  // 搜索商品列表
  return request({
    url: '/api/campaign/campaignQuery',
    method: 'post',
    data:obj
  })
}

/**
 * {
 *     id : '',
 *     status: ''
 * }
 * @param obj
 */
export function fetchintegralStatus(obj) {  //促销积分规则启动/停止
  return request({
    url: '/api/loyalty/pointsRuleTrans/openOrClose',
    method: 'post',
    data:obj
  })
}

export function addIntegralrule(obj) {  //新增促销积分规则
  return request({
    url: '/api/loyalty/pointsRuleTrans',
    method: 'put',
    data:obj
  })
}


export function fetchintegralDel(obj) {  //促销积分规则删除
  return request({
    url: '/api/loyalty/pointsRuleTrans/'+obj.id,
    method: 'delete',
    data:obj
  })
}


export function pointsTypeList() {  //查询促销积分规则分页列表
  return request({
    url: '/api/loyalty/pointsType/list',
    method: 'post'
  })
}







/** 编辑互动积分规则 */

export function behaviourTypePage(obj) {  //查询互动积分规则分页列表
  return request({
    url: '/api/transaction/behaviourType/page',
    method: 'post',
    data:obj
  })
}

export function pointsRuleBehaviourPage(obj) {  //查询互动积分规则分页列表
  return request({
    url: '/api/loyalty/pointsRuleBehaviour/page',
    method: 'post',
    data:obj
  })
}

export function fetintegralrule(obj) {  //查询积分规则编辑
  return request({
    url: '/api/campaign/'+obj.id,
    method: 'post',
    data:obj
  })
}

export function addintegralrule(obj) {  //添加积分规则
  return request({
    url: '/api/loyalty/pointsRuleBehaviour',
    method: 'post',
    data:obj
  })
}

export function editintegralrule(obj) {  //互动积分规则编辑
  return request({
    url: '/api/loyalty/pointsRuleBehaviour',
    method: 'put',
    data:obj
  })
}

export function delintegralrule(obj) {  //互动积分规则删除
  return request({
    url: '/api/loyalty/pointsRuleBehaviour/'+obj.id,
    method: 'delete',
    data:obj
  })
}
